﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuanLyDoiXe.Lop_du_lieu;

namespace QuanLyDoiXe.lop_doi_tuong
{
    class lop_NVcapnhienlieu
    {
        string MNVC,TenNV;
        int SDT;
        public lop_NVcapnhienlieu(){}
        public lop_NVcapnhienlieu(string MNVC,string TenNV, int SDT)
        {
            this.MNVC = MNVC;
            this.TenNV = TenNV;
            this.SDT=SDT;
        }
        #region Các phương thức hoạt động
        public bool taomoi()
        {
            Lop_lay_du_lieu dl = new Lop_lay_du_lieu();
            if (dl.thucthitruyvan("insert into NVcapnhienlieu values ('" + MNVC + "',N'" + TenNV + "','" + SDT +"')") == 1)
            {
               lop_ket_noi.huyketnoi();
               return true;
            }
            else
            {
                lop_ket_noi.huyketnoi();
                return false;
            }
        }
        public bool capnhat()
        {
            Lop_lay_du_lieu dl = new Lop_lay_du_lieu();
            if (dl.thucthitruyvan("update NVcapnhienlieu set TenNV=N'" + TenNV + "',SDT='" + SDT + "' where MNVC='" + MNVC + "'") == 1)
            {
                lop_ket_noi.huyketnoi();
                return true;
            }
            else
            {
                lop_ket_noi.huyketnoi();
                return false;
            }
        }
        public bool xoa()
        {
            Lop_lay_du_lieu dl = new Lop_lay_du_lieu();
            if (dl.thucthitruyvan("delete from NVcapnhienlieu where MNVC='" + MNVC + "'") == 1)
            {
                lop_ket_noi.huyketnoi();
                return true;
            }
            else
            {
                lop_ket_noi.huyketnoi();
                return false;
            }
        }
        #endregion
    }
}
